﻿/* ----------------------------------------------------------------------------
 * Copyright (c) Rob Ashton 2009
 *
 * This source code is subject to terms and conditions of the Microsoft Public 
 * License (Ms-PL).
 * 
 * By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 * 
 * To request a copy of the Microsoft Public License, send a request by email
 * to license@mvcex.com
 *
 * This notice must not be removed from this software.
 * ---------------------------------------------------------------------------- */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MvcEx.Views
{
    public class MvcExViewEngineConfiguration
    {
        private List<string> mComponents = new List<string>();
        private String mRoot;

        /// <summary>
        /// Gets a list of the components registered with this instance
        /// </summary>
        public String[] Components
        {
            get
            {
                return mComponents.ToArray();
            }
        }

        /// <summary>
        /// Gets the root location where views wil be loaded from
        /// </summary>
        public String Root
        {
            get
            {
                return mRoot;
            }
        }

        /// <summary>
        /// Registers a component with this instance
        /// </summary>
        /// <param name="component"></param>
        public void RegisterComponent(String component)
        {
            mComponents.Add(component);
        }

        /// <summary>
        /// Unregisters a component with this instance
        /// </summary>
        /// <param name="component"></param>
        public void UnregisterComponent(String component)
        {
            mComponents.Remove(component);
        }

        /// <summary>
        /// Creates a view engine configuration pointing at the root specified
        /// </summary>
        /// <param name="root"></param>
        public MvcExViewEngineConfiguration(String root)
        {
            mRoot = root;
        }
    }
}
